package com.googlecode.scenemaker3d.services
{
	import com.googlecode.scenemaker3d.controller.CameraController;
	import com.googlecode.scenemaker3d.controller.ICameraController;
	import com.googlecode.scenemaker3d.controller.IMaterialController;
	import com.googlecode.scenemaker3d.controller.IObjectController;
	import com.googlecode.scenemaker3d.controller.ITimelineController;
	import com.googlecode.scenemaker3d.controller.MaterialController;
	import com.googlecode.scenemaker3d.controller.ObjectController;
	import com.googlecode.scenemaker3d.controller.TimelineController;
	
	import com.googlecode.scenemaker3d.model.World3DModel;
	
	public class Control
	{
		private static var _instance:Control;
		private static var isOK:Boolean = false;
		
		[Bindable]
        public var world3DModel:World3DModel = new World3DModel();
		
		[Bindable]
        public var cameraController:ICameraController = new CameraController(world3DModel);
        
        [Bindable]
        public var objectController:IObjectController = new ObjectController(world3DModel);
        
        [Bindable]
        public var timelineController:ITimelineController = new TimelineController(world3DModel);
        
        [Bindable]
        public var materialController:IMaterialController = new MaterialController(world3DModel);
        		
		public function Control()
		{
			if(!isOK){
				throw(new Error("This is a singleton. Do not instantiate. Use Control.instance"));
			}
		}
		public static function get instance():Control
        {
        	if(!_instance){
				isOK = true;
				_instance = new Control();	
				isOK = false;
			}
			return _instance;
        }

	}
}